package com.cari.oa.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.cari.oa.domain.SoftBugCommentEntity;
import com.cari.oa.util.StrUtils;

@Repository
public class SoftBugCommentDao extends BaseDao<SoftBugCommentEntity> {
	
	/**
	* Title: getCommentByBugId
	* Description:根据BugId获取评论
	* @author    hjx 
	* @date      2013-2-16 
	* @param bugId
	* @return
	*/
    @SuppressWarnings("unchecked")
	public List<SoftBugCommentEntity> getCommentByBugId(String bugId)
    {
    	 StringBuilder hql = new StringBuilder();
	     hql.append(" from SoftBugCommentEntity s order by s.createTime desc");
	     if(StrUtils.isNotEmpty(bugId))
	     {
	    	hql.append(" where s.bugId = '"+ bugId+"'");
	     }
	     Query query = getSession().createQuery(hql.toString());
	     return query.list();
    }
}
